<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateStockOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('stock_orders',function(Blueprint $table){
            $table->increments('id');
            $table->integer('stock_activity_id')->comment('活动id');//活动id
            $table->integer('user_id')->comment('用户id');//活动发起人id
            $table->decimal('money',10,2)->comment('购入金额');//金额
            $table->decimal('pay_money',10,2)->comment('实际支付金额');//支付金额
            $table->integer('stock_code')->comment('股票代码');//股票代码
            $table->decimal('open_price',10,2)->default(0.00)->comment('开盘价');//买入价格
            $table->decimal('close_price',10,2)->default(0.00)->comment('收盘价');//结束价格
            $table->decimal('yield',10,2)->default(0.00)->comment('股票涨幅');//收益率
            $table->string('out_trade_no')->comment('商户订单编号');//活动名称
            $table->string('transaction_id')->nullable()->comment('订单流水编号');//微信订单编号
            $table->string('payment_time')->nullable()->comment('付款完成时间');
            $table->tinyInteger('status')->default(0)->comment('订单状态0-未支付，1-已支付');;//订单状态
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('order');
    }
}
